/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package linkedlist;

/**
 *
 * @author Islam Hamdi
 */
public class NodeD<T> {
private NodeD<T> next;// link_field indicating the next node
	private NodeD<T> prev;// link_field indicating the previous node.
	private T element;// Data field of the node

	/** Default constructor for a node */
	public NodeD() {
		next = null;
		prev = null;
		element = null;
	}

	/** Constructing a new node given element only */
	public NodeD(T obj) {
		next = null;
		prev = null;
		element = obj;
	}

	/** Constructing a new node given element and the next Node */
	public NodeD(T obj, NodeD<T> nextNode, NodeD<T> prevNode) {
		next = nextNode;
		prev = prevNode;
		element = obj;
	}

	/** Retreiving the next node */
	public NodeD<T> getNext() {
		return next;
	}

	/** Retreiving the previous node */
	public NodeD<T> getPrev() {
		return prev;
	}

	/** Setting the current node pointing next to the given node */
	public void setNext(NodeD<T> nextN) {
		next = nextN;
	}

	/** Setting the current node pointing previously to the given node */
	public void setPrev(NodeD<T> prevN) {
		prev = prevN;
	}

	/** Getting element of a node. */
	public T getElement() {
		return element;
	}

	/** Setting element of a note */
	public void setElement(T ob) {
		element = ob;
	}
}
